<!DOCTYPE html><html class="hide-aside" lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>HEXO | 活在当下的博客</title><meta name="author" content="活在当下"><meta name="copyright" content="活在当下"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="从零开始搭建个人博客 我为什么要搭建个人博客？  记录美好生活； 提升自己的技术水平； 空闲时间娱乐；   本博客由Github+Hexo搭建，下面我来介绍我做这个博客的全过程： 注册GitHub 首先进入GitHub官网  点击Sign up     输入你要注册的邮箱、密码  Create account     依次按照github的提示来做，之后就省略，不难。  Git安装步骤 进入Git">
<meta property="og:type" content="article">
<meta property="og:title" content="HEXO">
<meta property="og:url" content="http://czlifetime.github.io/2023/05/19/hello-world/index.html">
<meta property="og:site_name" content="活在当下的博客">
<meta property="og:description" content="从零开始搭建个人博客 我为什么要搭建个人博客？  记录美好生活； 提升自己的技术水平； 空闲时间娱乐；   本博客由Github+Hexo搭建，下面我来介绍我做这个博客的全过程： 注册GitHub 首先进入GitHub官网  点击Sign up     输入你要注册的邮箱、密码  Create account     依次按照github的提示来做，之后就省略，不难。  Git安装步骤 进入Git">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&biz_tag=Post">
<meta property="article:published_time" content="2023-05-19T12:17:11.096Z">
<meta property="article:modified_time" content="2023-05-26T13:12:05.144Z">
<meta property="article:author" content="活在当下">
<meta property="article:tag" content="Hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&biz_tag=Post"><link rel="shortcut icon" href="https://s2.loli.net/2023/05/21/wEIiLep9RY3UvV5.jpg"><link rel="canonical" href="http://czlifetime.github.io/2023/05/19/hello-world/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?5621d8cada923403e10d271a816fafbe";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 活在当下","link":"链接: ","source":"来源: 活在当下的博客","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'HEXO',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-05-26 21:12:05'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><link rel="stylesheet" href="APlayer.min.css"><div id="aplayer"></div><script src="https://cdn.jsdelivr.net/gh/radium-bit/res@master/live2d/autoload.js" async></script><script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js" async></script><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>const preloader = {
  endLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = 'hidden';
    document.getElementById('loading-box').classList.remove("loaded")
  }
}

preloader.initLoading()
window.addEventListener('load',()=> { preloader.endLoading() })

if (true) {
  document.addEventListener('pjax:send', () => { preloader.initLoading() })
  document.addEventListener('pjax:complete', () => { preloader.endLoading() })
}</script><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://s2.loli.net/2023/05/21/wEIiLep9RY3UvV5.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">5</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">4</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 类别</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&amp;biz_tag=Post')"><nav id="nav"><span id="blog-info"><a href="/" title="活在当下的博客"><span class="site-name">活在当下的博客</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 类别</span></a></div><div class="menus_item"><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></div><div class="menus_item"><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 视频</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">HEXO<a class="post-edit-link" href="null_posts/hello-world.md" title="编辑" target="_blank"><i class="fas fa-pencil-alt"></i></a></h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-05-19T12:17:11.096Z" title="发表于 2023-05-19 20:17:11">2023-05-19</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-05-26T13:12:05.144Z" title="更新于 2023-05-26 21:12:05">2023-05-26</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="HEXO"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="从零开始搭建个人博客"><a href="#从零开始搭建个人博客" class="headerlink" title="从零开始搭建个人博客"></a>从零开始搭建个人博客</h1><hr>
<p>我为什么要搭建个人博客？</p>
<ol>
<li>记录美好生活；</li>
<li>提升自己的技术水平；</li>
<li>空闲时间娱乐；</li>
</ol>
<hr>
<p><font color = "red" size ="5">本博客由Github+Hexo搭建，下面我来介绍我做这个博客的全过程：</font></p>
<h2 id="注册GitHub"><a href="#注册GitHub" class="headerlink" title="注册GitHub"></a>注册GitHub</h2><ol>
<li><p>首先进入<a target="_blank" rel="noopener" href="https://github.com/">GitHub官网</a></p>
</li>
<li><p>点击Sign up</p>
</li>
</ol>
<p><img src="https://s2.loli.net/2023/05/26/4spkv6yjKPYq2Qt.png"></p>
<ol start="3">
<li><p>输入你要注册的邮箱、密码<img src="https://s2.loli.net/2023/05/26/w5rAt1McU8DfLZF.png"></p>
</li>
<li><p>Create account</p>
</li>
</ol>
<p><img src="https://s2.loli.net/2023/05/26/qJ6LpkECcez42dF.png"></p>
<ol start="5">
<li>依次按照github的提示来做，之后就省略，不难。</li>
</ol>
<h2 id="Git安装步骤"><a href="#Git安装步骤" class="headerlink" title="Git安装步骤"></a>Git安装步骤</h2><ol>
<li><p>进入<a target="_blank" rel="noopener" href="https://git-scm.com/">Git官网</a>,想、点击Downloads</p>
<p><img src="https://s2.loli.net/2023/05/26/XCvmpUekgtPsNc1.png"></p>
</li>
<li><p>选择自己的系统</p>
<p><img src="https://s2.loli.net/2023/05/26/NVbQZjwHz5kDGqx.png"></p>
</li>
<li><p>选择自己的适合的版本<img src="https://s2.loli.net/2023/05/26/NVbQZjwHz5kDGqx.png"></p>
</li>
</ol>
<p>​	( 国内下载的速度慢，有时候还会下载失败，我这里提供<a target="_blank" rel="noopener" href="https://www.aliyundrive.com/s/32emvmTN9aV">Git-2.40.1-64-bit的安装包</a> )</p>
<ol start="4">
<li><p>下载完成打开</p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/yl4izRvqdTBLCn1.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/eNLwi4Sop3kAs8X.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/FmR3fzUq6wNl91H.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/uWtBQJraKdRG7Zh.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/rwGlm473aKEMWvA.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/D7NuTQsWAHjlrwy.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/TsWILrDS98yoOGb.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/Vn2f47LztITKk5p.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/Bzsw2Djd7FQc8m1.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/gmIUl8jCiRG2c5M.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/ECMy75odNPawH3b.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/SpCgHmPqcwUENIh.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/nERkNgU5zpiqxSX.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/NJkGvSWAt6wdFRH.png"></p>
</li>
<li><p><img src="https://s2.loli.net/2023/05/26/nHdCWkv5O92Sb3D.png"></p>
</li>
<li><p>鼠标左击出现这种情况就可以了</p>
<p><img src="https://s2.loli.net/2023/05/26/SQlBgaF2YvuLcCy.png"></p>
</li>
<li><p>打开Git Bash，输入git出现这种情况就可以了</p>
<p><img src="https://s2.loli.net/2023/05/26/ySnF47b2xWUaQ9i.png"></p>
</li>
</ol>
<h2 id="绑定GitHub并提交文件"><a href="#绑定GitHub并提交文件" class="headerlink" title="绑定GitHub并提交文件"></a>绑定GitHub并提交文件</h2><ol>
<li><p>打开Git bash 输入ssh，查看本机是否安装SSH</p>
<p><img src="https://s2.loli.net/2023/05/26/mKTCNa8wS2BYPuI.png"></p>
</li>
<li><p>输入<code>ssh-keygen -t rsa</code>，指定生成秘钥，接着再点击四次回车键，生成两个文件，分别为<code>id_rsa</code>，<code>id_rsa.pub</code>，按照指定的文件位置打开<code>id_rsa.pub</code>，复制下来</p>
<p><img src="https://s2.loli.net/2023/05/26/lmLI6WPkRhKiJcA.png"></p>
</li>
<li><p>打开github，在settings中<code>SSH and GPG keys</code>中添加秘钥，名称加不加都行</p>
<p><img src="https://s2.loli.net/2023/05/26/EesFogtycpwb3JV.png"></p>
<p><img src="https://s2.loli.net/2023/05/26/MK4F9RpHiC7OxIS.png"></p>
</li>
<li><p>验证是否成功，在Git Bash中输入<code>ssh -T github@github.com</code>进行验证</p>
<p><img src="https://s2.loli.net/2023/05/26/N8KvWDrzjohAwdb.png"></p>
</li>
</ol>
<h2 id="安装node-js和Hexo"><a href="#安装node-js和Hexo" class="headerlink" title="安装node.js和Hexo"></a>安装node.js和Hexo</h2><h3 id="安装node-js及环境变量适配"><a href="#安装node-js及环境变量适配" class="headerlink" title="安装node.js及环境变量适配"></a>安装node.js及环境变量适配</h3><p>大家可以看这篇<a target="_blank" rel="noopener" href="https://blog.csdn.net/antma/article/details/86104068">文章</a>，内容相当的详细</p>
<h3 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h3><ol>
<li><p>在github中新建一个仓库</p>
<p><img src="D:\Desktop\笔记\图片\GWQ2IX1NctS6TVR.png"></p>
</li>
<li><p>仓库名为<code>用户名+github.io</code></p>
<p><img src="https://s2.loli.net/2023/05/26/zHRwbt15yGinTIU.png"></p>
</li>
<li><p>点击到仓库的settings，出现这种情况就可以了</p>
<p><img src="https://s2.loli.net/2023/05/26/mevcw1kIht5UELn.png"></p>
</li>
<li><p>安装Hexo：在任意一个盘符下面新建一个<code>Blog</code>文件夹打开文件夹，使用git Bash 的管理员身份运行，输入<code>npm install -g hexo-cli</code>，安装完成之后，在使用<code>hexo init</code>命令初始化一下，输入<code>hexo g</code>静态部署，输入<code>hexo s</code>可以本地预览，在浏览器中输入<code>localhost:4000</code>，就可以本地预览网页了</p>
</li>
<li><p>将Hexo部署到GitHub中：打开Blog文件夹，打开<code>_config.yml</code>文件，滑到文件的最下方，修改</p>
<p><img src="https://s2.loli.net/2023/05/26/at2KjYhmLPAE84k.png"></p>
<p><img src="https://s2.loli.net/2023/05/26/16b3vVJNHitP4oX.png"></p>
<p><img src="https://s2.loli.net/2023/05/26/fSyYRl5OIFAJhcd.png"></p>
</li>
<li><p>然后回到<code>Blog</code>文件夹中，打开Git Bash，安装Git部署插件，输入命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>

<p>再输入以下的指令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean #清除缓存文件db.json和已生成的静态文件public</span><br><span class="line">hexo g     #生成网站静态文件到默认设置的 public 文件夹(hexo generate的缩写)</span><br><span class="line">hexo d     #自动生成网站静态文件，并部署到设定的仓库(hexo deploy 的缩写)</span><br></pre></td></tr></table></figure>

<p>在浏览器中输入<code>你的用户名+github.io</code>就可以访问网站了</p>
</li>
</ol>
<h2 id="解析域名"><a href="#解析域名" class="headerlink" title="解析域名"></a>解析域名</h2><ol>
<li><p>域名绝大部分是付费的，但是也有免费的，比如我的这个czlifetime.eu.org，具体的申请教程在<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1gs4y1J7xZ/?spm_id_from=333.880.my_history.page.click&vd_source=f38da837f7ffc103f340849927ff2d1f">这</a></p>
</li>
<li><p>得到域名后，在阿里云、腾讯云、华为云等可以解析，添加记录：A @ 185.199.108.153 和 A @ 185.199.109.153 和 A @ 185.199.110.153 和 A @ 185.199.111.153，任意选一个或两个就可以了</p>
</li>
<li><p>打开Blog文件夹里的source文件夹，添加CNAME文件，可以先创建一个CNAME.txt文件，打开后写上你的域名，不要加www否则每次访问都必须加www，但如果不带有www，以后访问的时候带不带www都可以访问，保存后记得要重命名，将.txt删除</p>
</li>
<li><p>第三步回到Blog 文件夹，右键打开Git Bash，依次输入下面三条命令:</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean #清除缓存文件db.json和已生成的静态文件public</span><br><span class="line">hexo g     #生成网站静态文件到默认设置的 public 文件夹(hexo generate的缩写)</span><br><span class="line">hexo d     #自动生成网站静态文件，并部署到设定的仓库(hexo deploy 的缩写)</span><br></pre></td></tr></table></figure>
</li>
<li><p>打开GitHub，看看CNAME文件是否已经在你的项目中，如果没有，可以在github的仓库中添加，最后github中也要把你的域名写进去</p>
<p><img src="https://s2.loli.net/2023/05/26/Z5SmLtMvVpyW4T3.png"></p>
</li>
</ol>
<h2 id="设置主题"><a href="#设置主题" class="headerlink" title="设置主题"></a>设置主题</h2><h3 id="推荐"><a href="#推荐" class="headerlink" title="推荐"></a>推荐</h3><p><code>hexo</code>有很多种主题，我推荐8种主题</p>
<ol>
<li>Butterfly<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">https://github.com/jerryc127/hexo-theme-butterfly</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://butterfly.js.org/">https://butterfly.js.org/</a></li>
</ul>
</li>
<li>ICARUS<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/ppoffice/hexo-theme-icarus">https://github.com/ppoffice/hexo-theme-icarus</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://ppoffice.github.io/hexo-theme-icarus/">https://ppoffice.github.io/hexo-theme-icarus/</a></li>
</ul>
</li>
<li>Fluid<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/fluid-dev/hexo-theme-fluid">https://github.com/fluid-dev/hexo-theme-fluid</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://hexo.fluid-dev.com/">hexo.fluid-dev.com&#x2F;</a></li>
</ul>
</li>
<li>Volantis<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/volantis-x/hexo-theme-volantis">https://github.com/volantis-x/hexo-theme-volantis</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://volantis.js.org/">volantis.js.org</a></li>
</ul>
</li>
<li>Snippet<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/shenliyang/hexo-theme-snippet">https://github.com/shenliyang/hexo-theme-snippet</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://snippet.shenliyang.com/">snippet.shenliyang.com&#x2F;</a></li>
</ul>
</li>
<li>Hacker<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/CodeDaraW/Hacker">https://github.com/CodeDaraW/Hacker</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://blog.daraw.cn/">blog.daraw.cn&#x2F;</a></li>
</ul>
</li>
<li>3-hexo<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/yelog/hexo-theme-3-hexo">https://github.com/yelog/hexo-theme-3-hexo</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://yelog.org/">yelog.org</a></li>
</ul>
</li>
<li>Cactus<ul>
<li>GitHub地址：<a target="_blank" rel="noopener" href="https://github.com/probberechts/hexo-theme-cactus">https://github.com/probberechts/hexo-theme-cactus</a></li>
<li>在线演示：<a target="_blank" rel="noopener" href="https://probberechts.github.io/hexo-theme-cactus/">probberechts.github.io&#x2F;hexo-theme-cactus&#x2F;</a></li>
</ul>
</li>
</ol>
<h3 id="配置"><a href="#配置" class="headerlink" title="配置"></a>配置</h3><p>点开GitHub的地址，详细的配置就在首页的md文件中，这里不过多赘述</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://czlifetime.github.io">活在当下</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://czlifetime.github.io/2023/05/19/hello-world/">http://czlifetime.github.io/2023/05/19/hello-world/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://czlifetime.github.io" target="_blank">活在当下的博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a></div><div class="post_share"><div class="social-share" data-image="https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&amp;biz_tag=Post" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wechat.jpg" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li><li class="reward-item"><a href="/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="/img/alipay.jpg" alt="alipay"/></a><div class="post-qr-code-desc">alipay</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/2023/05/19/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" title="数据结构"><img class="cover" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">数据结构</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://s2.loli.net/2023/05/21/wEIiLep9RY3UvV5.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">活在当下</div><div class="author-info__description">选择有时候比努力更重要</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">5</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">4</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/czlifetime"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/czlifetime" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=czlifetime@foxmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是我的博客</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%8E%E9%9B%B6%E5%BC%80%E5%A7%8B%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2"><span class="toc-number">1.</span> <span class="toc-text">从零开始搭建个人博客</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B3%A8%E5%86%8CGitHub"><span class="toc-number">1.1.</span> <span class="toc-text">注册GitHub</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Git%E5%AE%89%E8%A3%85%E6%AD%A5%E9%AA%A4"><span class="toc-number">1.2.</span> <span class="toc-text">Git安装步骤</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BB%91%E5%AE%9AGitHub%E5%B9%B6%E6%8F%90%E4%BA%A4%E6%96%87%E4%BB%B6"><span class="toc-number">1.3.</span> <span class="toc-text">绑定GitHub并提交文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%89%E8%A3%85node-js%E5%92%8CHexo"><span class="toc-number">1.4.</span> <span class="toc-text">安装node.js和Hexo</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85node-js%E5%8F%8A%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E9%80%82%E9%85%8D"><span class="toc-number">1.4.1.</span> <span class="toc-text">安装node.js及环境变量适配</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%AE%89%E8%A3%85Hexo"><span class="toc-number">1.4.2.</span> <span class="toc-text">安装Hexo</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%A7%A3%E6%9E%90%E5%9F%9F%E5%90%8D"><span class="toc-number">1.5.</span> <span class="toc-text">解析域名</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%AE%BE%E7%BD%AE%E4%B8%BB%E9%A2%98"><span class="toc-number">1.6.</span> <span class="toc-text">设置主题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8E%A8%E8%8D%90"><span class="toc-number">1.6.1.</span> <span class="toc-text">推荐</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE"><span class="toc-number">1.6.2.</span> <span class="toc-text">配置</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/06/23/IO%E6%B5%81/" title="I/O流"><img src="https://raw.githubusercontent.com/czlifetime/img/master/Java.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="I/O流"/></a><div class="content"><a class="title" href="/2023/06/23/IO%E6%B5%81/" title="I/O流">I/O流</a><time datetime="2023-06-23T12:49:11.792Z" title="发表于 2023-06-23 20:49:11">2023-06-23</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/06/23/%E6%80%9D%E6%83%B3/" title="Java设计思想"><img src="https://s2.loli.net/2023/06/23/B1KDXwqg6SY2Vn7.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java设计思想"/></a><div class="content"><a class="title" href="/2023/06/23/%E6%80%9D%E6%83%B3/" title="Java设计思想">Java设计思想</a><time datetime="2023-06-23T12:00:00.000Z" title="发表于 2023-06-23 20:00:00">2023-06-23</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/22/%E5%9B%BE/" title="图"><img src="https://s2.loli.net/2023/05/26/Pgiz3Z6RkfHyhSC.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="图"/></a><div class="content"><a class="title" href="/2023/05/22/%E5%9B%BE/" title="图">图</a><time datetime="2023-05-22T12:55:27.290Z" title="发表于 2023-05-22 20:55:27">2023-05-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/19/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" title="数据结构"><img src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="数据结构"/></a><div class="content"><a class="title" href="/2023/05/19/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84/" title="数据结构">数据结构</a><time datetime="2023-05-19T13:40:02.000Z" title="发表于 2023-05-19 21:40:02">2023-05-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/19/hello-world/" title="HEXO"><img src="https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&amp;biz_tag=Post" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="HEXO"/></a><div class="content"><a class="title" href="/2023/05/19/hello-world/" title="HEXO">HEXO</a><time datetime="2023-05-19T12:17:11.096Z" title="发表于 2023-05-19 20:17:11">2023-05-19</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://picx.zhimg.com/70/v2-41e1b825c51055f39c22b95777bc620b_1440w.avis?source=172ae18b&amp;biz_tag=Post')"><div id="footer-wrap"><div class="copyright">&copy;2023 By 活在当下</div><div class="footer_custom_text">czlifetime</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="聊天"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"><script>(() => {
  const $mermaidWrap = document.querySelectorAll('#article-container .mermaid-wrap')
  if ($mermaidWrap.length) {
    window.runMermaid = () => {
      window.loadMermaid = true
      const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'

      Array.from($mermaidWrap).forEach((item, index) => {
        const mermaidSrc = item.firstElementChild
        const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
        const mermaidID = 'mermaid-' + index
        const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
        mermaid.mermaidAPI.render(mermaidID, mermaidDefinition, (svgCode) => {
          mermaidSrc.insertAdjacentHTML('afterend', svgCode)
        })
      })
    }

    const loadMermaid = () => {
      window.loadMermaid ? runMermaid() : getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(runMermaid)
    }

    btf.addModeChange('mermaid', () => {
      window.runMermaid()
    })

    window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
  }
})()</script><script>(() => {
  function abcjsInit() {
    function abcjsFn() {
      for (let abcContainer of document.getElementsByClassName("abc-music-sheet")) {
        ABCJS.renderAbc(abcContainer, abcContainer.innerHTML, {responsive: 'resize'})
      }
    }
    
    typeof ABCJS === 'object' ? abcjsFn()
      : getScript('https://cdn.jsdelivr.net/npm/abcjs/dist/abcjs-basic-min.min.js').then(abcjsFn)
  }

  window.pjax ? abcjsInit() : document.addEventListener('DOMContentLoaded', abcjsInit)
})()</script><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'r1rCntFF11juImx92HoaC18u-gzGzoHsz',
      appKey: '2WhEyiHD6JMxamfRQ4YZOxRi',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="true" data-click="true"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = true;
document.body.addEventListener('input', POWERMODE);
</script><script>window.$crisp = [];
window.CRISP_WEBSITE_ID = "660b78d8-560b-4097-b2f6-7667753c4d50";
(function () {
  d = document;
  s = d.createElement("script");
  s.src = "https://client.crisp.chat/l.js";
  s.async = 1;
  d.getElementsByTagName("head")[0].appendChild(s);
})();
$crisp.push(["safe", true])

if (true) {
  $crisp.push(["do", "chat:hide"])
  $crisp.push(["on", "chat:closed", function() {
    $crisp.push(["do", "chat:hide"])
  }])
  var chatBtnFn = () => {
    var chatBtn = document.getElementById("chat_btn")
    chatBtn.addEventListener("click", function(){
      $crisp.push(["do", "chat:show"])
      $crisp.push(["do", "chat:open"])

    });
  }
  chatBtnFn()
} else {
  if (false) {
    function chatBtnHide () {
      $crisp.push(["do", "chat:hide"])
    }
    function chatBtnShow () {
      $crisp.push(["do", "chat:show"])
    }
  }
}</script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css"><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/meting@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div></body></html>